.SUFFIXES : .x .o .c .s

CC := aarch64-nuvoton-linux-gnu-gcc
STRIP := aarch64-nuvoton-linux-gnu-strip

TARGET = mqtt_test
LIBS = -lpthread -lc -lgcc
CFLAGS = -Wall -O2 -g -I./ -I./include -I./protocol
LDFLAGS = -L./lib -lpaho-mqtt3a -lpaho-mqtt3c


#需要编译的源文件
SRCS += main.c
SRCS += mqtt.c
SRCS += common.c
SRCS += global_var.c
SRCS += protocol/protocol_pack.c
SRCS += protocol/protocol_analyze.c


all:
	$(CC) -static $(SRCS) -o $(TARGET) $(LIBS) $(CFLAGS) $(LDFLAGS)
	$(STRIP) $(TARGET)

clean:
	rm -f *.o
	rm -f *.x
	rm -f *.flat
	rm -f *.map
	rm -f temp
	rm -f *.img
	rm -f $(TARGET)
	rm -f *.gdb
